<!DOCTYPE html>
<#assign f = JspTaglibs["http://www.casic304.cn/f"] />
<#assign SourceDept = JspTaglibs["http://www.casic304.cn/SourceDept"]/>
<#assign DutyDept = JspTaglibs["http://www.casic304.cn/DutyDept"]/>
<head>
    <meta charset="utf-8">
    <title>质量问题管理信息列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/qbdmsStatic/style/qbdms.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
    <style>
        .layui-form-onswitch{
            border-color: #2682FF;
            background-color: #2682FF;
        }
    </style>
</head>
<body class="listBody">
<div hidden style="display: none" id="returnMsgDiv">
    <title>退回意见</title>
    <span style="text-align: center">
        <textarea autocomplete="off" lay-verify="required" class="layui-textarea" style="width: 90%;margin: auto;margin-top: 15px;" placeholder="请输入" maxlength="100" id="returnMsg" name="returnMsg"></textarea>
    </span>
</div>
<div class="qbdms-list">
    <div class="layui-table-view-body">
        <table id="wQbdFalProblemresetTable" lay-filter="wQbdFalProblemresetTable"></table>
    </div>
</div>
<!-- 列表头部工具栏 -->
<script type="text/html" id="wQbdFalProblemresetHeaderToolsBar">
    <div class="ccpui-enterSel layui-form" lay-filter="wQbdFalProblemresetQueryForm">
        <div class="layui-btn-container qbdms-title">
            <@f.a alias="xzan_zlwt302" event="add" css="layui-btn layui-btn-sm fillBtn" >
                <span>新增</span>
            </@f.a>

            <@f.a alias="scan_zlwt302" event="delete" css="layui-btn layui-btn-sm" >
                <span>删除</span>
            </@f.a>
           <a class="layui-btn layui-btn-sm" lay-event="export">
                <span>导出</span>
            </a>

            <a class="layui-btn layui-btn-sm" lay-event="listStyle">
                <span>配置列</span>
            </a>
            <@f.a alias="sban_zlwt302" event="report" css="layui-btn layui-btn-sm" >
                <span>上报</span>
            </@f.a>
        </div>

    <form class="" action="" lay-filter="wQbdFalProblemresetQueryForm">
            <div class="layui-form-body selch">
                <div class="table-top-filter layui-row">
                    <@SourceDept.dept css="layui-input filter-value"/>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">质量问题名称</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input filter-value" name="Q_fProblemname_SL"
                                   placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">型号代号</label>
                        <div class="layui-input-block">
                            <select class="layui-input filter-value" name="Q_fModelsymbol_S" lay-filter="xh"
                                    lay-verify="required" lay-search="" placeholder="请输入"/></select>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">故障产品名称</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input filter-value" name="Q_fProductname_SL"
                                   placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">型号研制阶段</label>
                        <div class="layui-input-block">
                            <select class="layui-input filter-value" lay-verify="required" lay-search=""
                                    name="Q_fModeldevelopphase_S" placeholder="请输入"/></select>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">责任单位研究室</label>
                        <div class="layui-input-block">
                            <select id="fDutydept" name="Q_fDutydeptRoom_S" autocomplete="off"
                                    class="layui-input filter-value" lay-filter="fDutydeptRoom"
                                    fieldname="fDutydeptRoom">
                            </select>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">是否完成归零</label>
                        <div class="layui-input-block">
                            <select class="layui-input filter-value" lay-verify="required" lay-search=""
                                    lay-filter="fIfreset" name="Q_fIfreset_S" placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">开始时间</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input start_time1 filter-value" name="Q_beginTime_DL"
                                 readonly  placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">结束时间</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input end_time1 filter-value" name="Q_endTime_DE"
                                   readonly   placeholder="请输入"/>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">问题级别</label>
                        <div class="layui-input-block">
                            <select class="layui-input filter-value" lay-verify="required" lay-search=""
                                    name="Q_fProblemlever_S" placeholder="请输入"/></select>
                        </div>
                    </div>
                    <div class="qbdms-listForm">
                        <label class="layui-form-label">审批状态</label>
                        <div class="layui-input-block">
                            <select class="layui-input filter-value" lay-verify="required" lay-search=""
                                    name="Q_flowStatus_S" placeholder="请输入"/></select>
                        </div>
                    </div>
                    <!--<div class="qbdms-listForm">-->
                        <!--<label class="layui-form-label">高级检索</label>-->
                        <!--<div class="layui-input-block">-->
                            <!--<input type="text" id="" class="layui-input filter-value" name="Q_content_S"-->
                                   <!--placeholder="请输入" maxlength="50"/>-->
                        <!--</div>-->
                    <!--</div>-->

                </div>
                <div class="selchBtn">
                    <a class="layui-btn layui-btn-sm fillBtn" lay-event="query">
                        <span>查询</span>
                    </a>
                    <div class="layui-btn-group">
                        <button type="button" class="layui-btn layui-btn-sm" lay-event="clears" style="width: 28px;font-size: 12px;padding: 0">
                            <i class="iconfont data-iconcommon_refresh"></i>
                        </button>
                        <button type="button" class="layui-btn layui-btn-sm screenParent" lay-event="screen" style="width: 28px;font-size: 12px;padding: 0">
                            <i class="iconfont data-iconcommon_downarrow screen"></i>
                        </button>
                    </div>
                </div>
            </div>

        </form >
    </div>

</script>
<!-- 右侧工具栏 -->
<script type="text/html" id="wQbdFalProblemresetRightToolsBar">
    {{# if((d.allowEdit&&'${currentUserId}'==d.fCreateby)||'${roleAlias}'=='bpm_zlzhzly'&&d.flowStatus=='99'){}}
        <@f.a alias="xgan_zlwt302" event="edit" css="RightBtn">编辑</@f.a>
    {{#  } }}
    <@f.a alias="xqan_zlwt302" event="particulars" css="RightBtn">详情</@f.a>


    {{# if((d.allowDel&&'${currentUserId}'==d.fCreateby)||'${roleAlias}'=='bpm_zlzhzly'){}}
    <@f.a alias="scan_zlwt302" event="del" css="RightBtn">删除</@f.a>
    {{#  } }}
    <@f.a alias="jzan_zlwt302" event="progress" css="RightBtn">进展</@f.a>
    <@f.a alias="ylwtan_zlwt302" event="plan" css="RightBtn">遗留问题</@f.a>
</script>
<script src="${ctx}/qbdmsStatic/public/configFile.js"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>
    layui.config({
        base: serverPath.qbdmsPath + staticPath.qbdmsPath //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','table', 'form', 'common','jquery','layer','publicMethods','propsHandle'], function () {
        var table = layui.table;
        var form = layui.form;
        var common = layui.common;
        var publicMethods = layui.publicMethods;
        var $ = layui.jquery;
        var layer = layui.layer;
        var propsHandle = layui.propsHandle;
        var defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                selectorBtn: '.selectorBtn'
            },
            temQuery = new propsHandle();  // 实例化模板功能部分
        temQuery.initTem({
            selectorBtn: defProps.selectorBtn,
            selectorTemPath: setter.views + defProps.viewMould
        });
        var loading;
        common.tableSort('wQbdFalProblemresetTable');
        var tableH=publicMethods.tabHeight();
        var cols = '${cols}';
        //第一个实例
        window.tableInstace = function(tcols){
            if(tcols){
                cols = tcols;
            }
            if(cols){
                cols = JSON.parse(cols,function(k,v){
                    if(v.indexOf && v.indexOf('function') > -1){
                        return eval("(function(){return "+v+" })()")
                    }
                    return v;
                })
            }


            var currentSystemLevel = "${currentSystemLevel}";
            var headerCols = [
                {type: 'checkbox', fixed: 'left'}
                ,{field: 'sn', type: 'numbers', title: '序号', fixed: 'left'}
            ];
            var fillDeptCols = [];
            if ("GROUPLEVEL" === currentSystemLevel) {
                fillDeptCols = [{field: 'filldeptHospital', title: '数据来源单位', sort: false, sortname: 'filldepthospital',minWidth:'120'}];
            } else if ("HOSPITALLEVEL" === currentSystemLevel) {
                fillDeptCols = [{field: 'filldept', title: '数据来源单位', sort: false, sortname: 'filldept',minWidth:'120'}];
            } else if ("PLANTLEVEL" === currentSystemLevel) {
                fillDeptCols = [{field: 'filldept', title: '数据来源单位', sort: false, sortname: 'filldept',minWidth:'120'}];
            }
            var fieldsCols = [ //表头
                // ,{field: 'filldept', title: '数据来源单位',sort:false, sortname: 'filldept',hide:false}
                {field: 'fillman', title: '数据填写人',sort:false, sortname: 'fillman',hide:true,minWidth:'140'}
                ,{field: 'reportDate', title: '数据上报时间',sort:false, sortname: 'REPORT_DATE',hide:true,templet: function (d) {
                        return publicMethods.timeData(d.reportDate,1);
                    }}
                ,{field: 'fProblemname', title: '质量问题名称',sort:false, sortname: 'f_problemname',hide:false,minWidth:'120'}
                ,{field: 'fModelsymbol', title: '型号代号',sort:false, sortname: 'f_modelsymbol',hide:false,minWidth:'140'}
                ,{field: 'fProductname', title: '故障产品名称',sort:false, sortname: 'f_productname',hide:false,minWidth:'120'}
                ,{field: 'fDetecttime', title: '问题发生时间',sort:false, sortname: 'f_detecttime',hide:false,minWidth:'120',templet: function (d) {
                        return publicMethods.timeData(d.fDetecttime);
                    }}
                ,{field: 'secret', title: '密级',sort:false, sortname: 'secret',hide:true,minWidth:'60'}
                ,{field: 'fModelname', title: '型号名称',sort:false, sortname: 'f_modelname',hide:true,minWidth:'100'}
                ,{field: 'fModelbatchno', title: '型号批次',sort:false, sortname: 'f_modelbatchno',hide:true,minWidth:'100'}
                ,{field: 'fModeldevelopphase', title: '型号研制阶段',sort:false, sortname: 'f_modeldevelopphase',hide:false,minWidth:'120'}
                ,{field: 'fModeltype', title: '型号类别',sort:false, sortname: 'f_modeltype',hide:true,minWidth:'100'}
                ,{field: 'fWorkphase1', title: '工作阶段',sort:false, sortname: 'f_workphase1',hide:true,minWidth:'100'}
                ,{field: 'fProductbatchno', title: '故障产品所属的产品批次',sort:false, sortname: 'f_productbatchno',hide:true,minWidth:'280'}
                ,{field: 'fProduceclass', title: '生产分类',sort:false, sortname: 'f_produceclass',hide:true,minWidth:'100'}
                ,{field: 'fBreakphase', title: '故障件阶段',sort:false, sortname: 'f_breakphase',hide:true,minWidth:'140'}
                ,{field: 'fProductlevel', title: '产品级别',sort:false, sortname: 'f_productlevel',hide:true,minWidth:'100'}
                ,{field: 'fProductdesigndept', title: '产品设计单位',sort:false, sortname: 'f_productdesigndept',hide:true,minWidth:'140'}
                ,{field: 'fProductproducedept', title: '产品生产单位',sort:false, sortname: 'f_productproducedept',hide:true,minWidth:'140'}
                ,{field: 'fDetectplace', title: '问题发生地点',sort:false, sortname: 'f_detectplace',hide:true,minWidth:'140'}
                ,{field: 'fSubsystemname', title: '所属分系统名称',sort:false, sortname: 'f_subsystemname',hide:true,minWidth:'170'}
                ,{field: 'fIffirstfly', title: '是否首飞',sort:false, sortname: 'f_iffirstfly',hide:true,minWidth:'100'}
                ,{field: 'fIfshooting', title: '是否靶场质量问题',sort:false, sortname: 'f_ifshooting',hide:true,minWidth:'180'}
                ,{field: 'fIfbatch', title: '是否批次性',sort:false, sortname: 'f_ifbatch',hide:true,minWidth:'140'}
                ,{field: 'fIfthree', title: '是否三类问题',sort:false, sortname: 'f_ifthree',hide:true,minWidth:'120'}
                ,{field: 'fProblemrank', title: '问题等级',sort:false, sortname: 'f_problemrank',hide:true,minWidth:'100'}
                ,{field: 'fSofthard', title: '（故障产品）硬件/软件',sort:false, sortname: 'f_softhard',hide:true,minWidth:'300'}
                ,{field: 'fResetday', title: '归零周期（天）',sort:false, sortname: 'f_resetday',hide:true,minWidth:'170'}
                //缺少质量部门负责人  三院需求暂时不处理
                ,{field: 'fFailuredescription', title: '问题/故障现象描述',sort:false, sortname: 'f_failuredescription',hide:true,minWidth:'280'}
                ,{field: 'fDeepreason', title: '深层次原因',sort:false, sortname: 'f_deepreason',hide:true,minWidth:'140'}
                ,{field: 'fCausation', title: '问题原因描述',sort:false, sortname: 'f_causation',hide:true,minWidth:'140'}
                ,{field: 'fFourrefer', title: '“四个两”要求对照分析',sort:false, sortname: 'f_fourrefer',hide:true,minWidth:'260'}
                ,{field: 'fRanage', title: '举一反三',sort:false, sortname: 'f_ranage',hide:true,minWidth:'100'}
                ,{field: 'fCorrectmeasure', title: '纠正措施',sort:false, sortname: 'f_correctmeasure',hide:true,minWidth:'100'}
                ,{field: 'fManagefactoranalysis', title: '管理因素分析',sort:false, sortname: 'f_managefactoranalysis',hide:true,minWidth:'120'}
                ,{field: 'fCausationclass1', title: '原因分类（一级）',sort:false, sortname: 'f_causationclass1',hide:true,minWidth:'270'}
                ,{field: 'fCausationclass2', title: '原因分类（二级）',sort:false, sortname: 'f_causationclass2',hide:true,minWidth:'270'}
                ,{field: 'fCausationclass3', title: '原因分类（三级）',sort:false, sortname: 'f_causationclass3',hide:true,minWidth:'270'}
                ,{field: 'fDutydeptRoomName', title: '问题责任研究室',sort:false, sortname: 'fDutydeptRoomName',hide:false,minWidth:'140'}
                ,{field: 'fDutydeptnature', title: '责任单位性质',sort:false, sortname: 'f_dutydeptnature',hide:true,minWidth:'120'}
                ,{field: 'fIfreset', title: '是否完成归零',sort:false, sortname: 'f_ifreset',hide:false,minWidth:'120'}
                ,{field: 'fResettype', title: '归零方式',sort:false, sortname: 'f_resettype',hide:true,minWidth:'100'}
                ,{field: 'fSkillresettime', title: '技术归零时间',sort:false, sortname: 'f_skillresettime',hide:true,minWidth:'120',templet: function (d) {
                        return publicMethods.timeData(d.fSkillresettime);
                    }}
                ,{field: 'fManageresettime', title: '管理归零时间',sort:false,hide:true, sortname: 'f_manageresettime',minWidth:'100',templet: function (d) {
                        return publicMethods.timeData(d.fManageresettime);
                    }}
                ,{field: 'fProblemlever', title: '问题级别',sort:false, sortname: 'f_problemlever',hide:false,minWidth:'100'}
                //故障产品所属类别 已经去掉
                ,{field: 'fSolveresult', title: '解决情况',sort:false, sortname: 'f_solveresult',hide:true,minWidth:'100'}
                ,{field: 'fMeasureclass', title: '问题处理方式',sort:false, sortname: 'f_measureclass',hide:true,minWidth:'120'}
                ,{field: 'flowStatusStr', title: '审批状态',sort:false, sortname: 'REPORT_STATUS',hide:false,minWidth:'200'
                    // ,templet: function (d) {
                    //     return common.stateType(d);
                    // }
                    }
                ,{
                    fixed: 'right',
                    title: '管理',
                    minWidth:'120',
                    toolbar: '#wQbdFalProblemresetRightToolsBar'
                }
            ];

            window.tableInstace.initCols = headerCols.concat(fillDeptCols).concat(fieldsCols);

            window.tableInstace.tRender = table.render({
                elem: '#wQbdFalProblemresetTable'
                ,height:tableH
                ,url: serverPath.qbdmsPath + '/qbdms/wQbdFalProblemreset/list'
                ,page: publicMethods.pageFun() //开启分页
                ,toolbar: '#wQbdFalProblemresetHeaderToolsBar'
                ,method: 'post'
                ,autoSort: false //是否排序
                ,limit:20
                ,cols: [cols?cols:window.tableInstace.initCols]
                ,loading:true
                ,defaultToolbar: ['']
                ,done:function (obj) {
                    layer.close(loading);
                    common.tableSelectCon('.ccpui-enterSel .layui-form input','a[lay-event=query]','.ccpui-enterSel');
                }
                ,parseData: function(res){ //res 即为原始返回的数据

                    common.parseDataList(res,['fIfreset','fModeltype','fModelsymbol','fProductname','fModeldevelopphase','fDutydept','filldeptHospital']);
                    return {
                        "code": res.code, //解析接口状态
                        "msg": res.msg, //解析提示文本
                        "count": res.count, //解析数据长度
                        "data": res.data //解析数据列表
                    };
                }
            });
        };
        window.tableInstace(cols);

        //list页面初始化展开按钮tips展示（展开按钮类名）
        publicMethods.tipsAuto('.screen')
        //筛选条件初始化（页面表格的Id，是否初始化（true、false））
        common.initScreenTop('wQbdFalProblemresetTable',true);

        function dateReflash() {
            publicMethods.reflashDate({startName:'.start_time1',endName:'.end_time1'});
        }

//监听排序事件
        table.on('sort(wQbdFalProblemresetTable)', function(obj){ //注：sort 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
            reflashQuery(false);
        });

        function reflashQuery(isClear) {
            tableConditionRender("wQbdFalProblemresetTable","wQbdFalProblemresetQueryForm",{where:{}},isClear, false, 20);
            initQueryCol();
        }

        function initQueryCol(){
            var xhdh = eval('${wQbdXhdhs}'); //型号代号
            var initXHDH = function(optionObj, item){
                optionObj.text = item.fModelcode;
                optionObj.value = item.fModelcode;
                optionObj.setAttribute("xhmc", item.fModelname);
            };
            common.initDicData("Q_fModelsymbol_S", xhdh, "", initXHDH);
            var xhyzjdList = eval('${xhyzjdList}'); //型号研制阶段
            common.initDicData("Q_fModeldevelopphase_S", xhyzjdList);
            var sfList = eval('${sfList}'); //是否
            common.initDicData("Q_fIfreset_S", sfList, "");
            var wtjbList = eval('${wtjbList}'); //问题级别
            common.initDicData("Q_fProblemlever_S", wtjbList, "");
            var flowStatusList = eval('${flowStatusList}'); //状态
            common.initDicData("Q_flowStatus_S", flowStatusList, "");
            var researchRoomList = eval('${researchRoomList}'); //问题责任单位（研究室）
            var researchRoom = function(optionObj, item){
                optionObj.text = item.orgName;
                optionObj.value = item.code;
            };
            common.initDicData("Q_fDutydeptRoom_S", researchRoomList, "", researchRoom);
        }



        var returnMsgIndex;
        table.on('toolbar(wQbdFalProblemresetTable)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id);
            var data = checkStatus.data;
            var _this = this;
            var layerH=publicMethods.layHeight('.listBody');
            switch (obj.event) {
                case 'add':
                    window.location.href = serverPath.qbdmsPath + "/qbdms/wQbdFalProblemreset/view/add";
                    break;
                case 'delete':
                    var array = "";
                    for (var i = 0; i < data.length; i++) {
                        array+=data[i].id+",";
                    }
                    delFun(data,array);
                    break;
                case 'export':
                    function open(url , param){
                        var curUrl = url;
                        layer.open({
                            type: 2,
                            area: ['700px', '520px'],
                            title: ['自定义导出', 'font-size:14px;'],
                            content: serverPath.qbdmsPath + '/qbdms/wQbdFalProblemreset/view/export',
                            btnAlign: 'c',
                            skin: 'qbdms-layerFormBtn',
                            btn: ['确定', '取消'],
                            yes: function(index, layero){
                                url = curUrl;
                                var iframeWin = window["layui-layer-iframe" + index];
                                var data = iframeWin.getData();
                                if(data){
                                    url = url + "?data=" + JSON.stringify(data) + param;
                                    window.location.href = encodeURI(url)
                                }
                            }
                        });
                    }
                    if (data.length == 0) {
                        layer.confirm(publicMethods.confirmStyle('还没有选择，是否导出全部?'),{title: false,skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            var url = serverPath.qbdmsPath + '/qbdms/wQbdFalProblemreset/exportData';
                            var param = "";
                            $("form[lay-filter='wQbdFalProblemresetQueryForm']").find(".filter-value").each(function(i,value) {
                                param += "&"+this.name+"="+this.value
                            });
                            open(url , param);
                        });
                    } else {
                        layer.confirm(publicMethods.confirmStyle('确定导出吗?'),{title: false,skin: 'confirm-class'}, function (index) {
                            layer.close(index);
                            var ids = [];
                            for (var i = 0; i < data.length; i++) {
                                ids.push(data[i].id);
                            }
                            var url = serverPath.qbdmsPath + '/qbdms/wQbdFalProblemreset/exportData';
                            open(url , "&id="+ids);
                        });
                    }
                    break;

                case "query":
                    loading = layer.load(2, {
                        shade: [0.3, '#ccc'] //0.1透明度的白色背景
                    });
                    reflashQuery(false);
                    dateReflash();
                    if (parseInt($('.selch .layui-row').css('width'))<=524){
                        //筛选条件初始化（页面表格的Id，是否初始化（true、false））
                        common.initScreenTop('wQbdFalProblemresetTable',true);
                        $('.selchBtn button i.screen').addClass("data-iconcommon_downarrow").removeClass('data-iconcommon_uparrow')
                    }
                    break;
                case "listStyle":
                    layer.open({
                        type: 2,
                        area: ['80%', layerH],
                        skin: 'qbdms-layerFormBtn',
                        title: ['新增列表样式', 'font-size:14px;'],
                        content: serverPath.qbdmsPath + '/qbdms/wCustomColumns/view/list',
                        success:function (layero, index) {
                            publicMethods.tipsAuto(layero.find('.layui-layer-setwin'),'点击这里关闭弹框哦',2000)
                        }
                    });
                    break;
                case "clears":
                    reflashQuery(true);
                    dateReflash();
                    break;
                case "screen":
                    common.initScreenTop('wQbdFalProblemresetTable');
                    dateReflash();
                    form.render();
                    break;
                case "report":
                    var array = "";
                    for (var i = 0; i < data.length; i++) {
                        array+=data[i].id+",";
                    }
                    //业务表名,勾选数据主键,流程key,table标签lay-filter属性值,form标签lay-filter属性值,是否允许重复上报,页面所在包名,流程定义id
                    common.report("w_qbd_fal_problemreset",array,"plantToHospital","wQbdFalProblemresetTable","wQbdFalProblemresetQueryForm",true,"wQbdFalProblemreset","plantToHospital:1:72d05d40362249118c5453aa60c6da90");
                    dateReflash();
                    break;
                case "returnAndUpdate":
                    if (data.length === 0) {
                        layer.confirm(publicMethods.confirmStyle("请先选择一行数据!"),{title: false,skin: 'confirm-class'});
                    } else{
                        var array = "";
                        for (var i = 0; i < data.length; i++) {
                            array+=data[i].id+",";
                        }
                        returnMsgIndex = layer.open({
                            type: 1,
                            area: ['400px', '240px'],
                            title: ['退回意见'],
                            content: $("#returnMsgDiv"),
                            btn: ['退回','关闭'],
                            btnAlign: 'c',
                            yes: function(index,layero){
                                var returnMsgData = $("#returnMsg").val();
                                if(returnMsgData == '' || returnMsgData == null){
                                    layer.msg("退回意见不能为空!", {icon: 5,ime:1000,shift:6});
                                    return;
                                }
                                common.returnAndUpdate("w_qbd_fal_problemreset",array,"wQbdFalProblemresetTable","wQbdFalProblemresetQueryForm",returnMsgData,"wQbdFalProblemreset");
                                dateReflash();
                                layer.close(returnMsgIndex);
                            },
                            btn2: function(index, layero){
                                layer.close(returnMsgIndex);
                            },
                            end:function () {
                                layer.close(returnMsgIndex);
                                $("#returnMsg").val("");
                            }
                        })
                    }
                    break;
                case "doNotNeedReport":
                    var array = "";
                    for (var i = 0; i < data.length; i++) {
                        array+=data[i].id+",";
                    }
                    common.doNotNeedReport("w_qbd_fal_problemreset",array,"wQbdFalProblemresetTable","wQbdFalProblemresetQueryForm","wQbdFalProblemreset");
                    dateReflash();
                    break;
                case "doConfirmZero":
                    var array = "";
                    for (var i = 0; i < data.length; i++) {
                        array+=data[i].id+",";
                    }
                    confirmZero(data,array);
                    break;

            };
        });

        table.on('tool(wQbdFalProblemresetTable)', function(obj) {
            var data = obj.data, //获得当前行数据
                    layEvent = obj.event; //获得 lay-event 对应的值
            switch(layEvent){
                case "edit":
                    window.location.href = serverPath.qbdmsPath + "/qbdms/wQbdFalProblemreset/view/add?id="+data.id
                    break;
                case "particulars":
                     window.location.href =  serverPath.qbdmsPath + '/qbdms/wQbdFalProblemreset/view/particulars?id='+data.id+"&isShow=true"
                     break;
                case "progress":
                    window.location.href =  serverPath.qbdmsPath + '/qbdms/wQbdFalProblemreset/view/progress?id='+data.id
                    break;
                case "plan":
                    window.location.href =  serverPath.qbdmsPath + '/qbdms/wQbdFalProblemreset/view/addPlan?id='+data.id
                    break;
                case "del":
                    delFun(data,data.id);
                    break;
            }
        });

        function confirmZero(data, id) {
            if (data.length === 0) {
                layer.confirm(publicMethods.confirmStyle("请先选择一行数据!"),{title: false,skin: 'confirm-class'});
            } else {
                layer.confirm(publicMethods.confirmStyle('确定当前数据吗?'),{title: false,skin: 'confirm-class'},function (index) {
                    layer.close(index);
                    $.ajax({
                        url: serverPath.qbdmsPath + "/qbdms/wQbdFalProblemreset/confirmZero",
                        type: "post",
                        data: {idArrStr:id},
                        dataType: 'json',
                        success: function (data) {
                            layer.alert(data.msg);
                            //执行重载
                            reflashQuery(true);
                            dateReflash();
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            layer.alert(data.msg);
                            //执行重载
                            reflashQuery(true);
                            dateReflash();
                        }
                    })
                })
            }
        }

        function delFun(data,id) {
            if (data.length === 0) {
                layer.confirm(publicMethods.confirmStyle("请先选择一行数据!"),{title: false,skin: 'confirm-class'});
            } else {
                layer.confirm(publicMethods.confirmStyle('确定删除当前数据吗?'),{title: false,skin: 'confirm-class'},function (index) {
                    layer.close(index);
                    $.ajax({
                        url: serverPath.qbdmsPath + "/qbdms/wQbdFalProblemreset/del",
                        type: "post",
                        data: {id:id},
                        dataType: 'json',
                        success: function (data) {
                            layer.confirm(publicMethods.confirmStyle(data.msg),{title: false,skin: 'confirm-class'});
                            //执行重载
                            reflashQuery(true);
                            dateReflash();
                        },
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                            layer.confirm(publicMethods.confirmStyle(data.msg),{title: false,skin: 'confirm-class'});
                            //执行重载
                            reflashQuery(true);
                            dateReflash();
                        }
                    })
                })
            }
        }

        // <!--        function reflashQueryES(isClear) {-->
        // <!--            common.tableConditionRender("wQbdFalProblemresetTable","wQbdFalProblemresetQueryFormES",{where:{}},isClear);-->
        // <!--        }-->

        var xhdh = eval('${wQbdXhdhs}'); //型号代号
        var initXHDH = function(optionObj, item){
            optionObj.text = item.fModelcode;
            optionObj.value = item.fModelcode;
            optionObj.setAttribute("xhmc", item.fModelname);
        };
        common.initDicData("Q_fModelsymbol_S", xhdh, "", initXHDH);
        var xhyzjdList = eval('${xhyzjdList}'); //型号研制阶段
        common.initDicData("Q_fModeldevelopphase_S", xhyzjdList);
        var sfList = eval('${sfList}'); //是否
        common.initDicData("Q_fIfreset_S", sfList, "");
        var wtjbList = eval('${wtjbList}'); //问题级别
        common.initDicData("Q_fProblemlever_S", wtjbList, "");
        var flowStatusList = eval('${flowStatusList}'); //状态
        common.initDicData("Q_flowStatus_S", flowStatusList, "");
        var researchRoomList = eval('${researchRoomList}'); //问题责任单位（研究室）
        var researchRoom = function(optionObj, item){
            optionObj.text = item.orgName;
            optionObj.value = item.code;
        };
        common.initDicData("Q_fDutydeptRoom_S", researchRoomList, "", researchRoom);
        form.on('switch(encrypt)', function(data){
            if (!data.elem.checked){
                $("#Q_fj_S").val("1");
            } else {
                $("#Q_fj_S").val("0");
            }
        });


        /**
         * 监听table带条件渲染事件
         * @param tableLayFilter      表的layui-Filter
         * @param paramFormLayFilter  查询form的layui-Filter
         * @param paramJson           tableReload额外的参数json{"name":"value"}
         * @param isClear             是否清空form中参数  true 清空  false 不清空
         * @param isPage              是否分页,有分页不需要传值,没有分页需要传值true
         * @param limit               每页显示的记录数，如果不传值，默认10条每页
         * ！！！！！！！！！！！！千万不要删除！！！！！！！！！！！！！！！！！！
         * ！！！！！！！这个不能用公用方法，里面写了业务逻辑！！！！！！！！！！！
         * ！！！！！！！！！！！！千万不要删除！！！！！！！！！！！！！！！！！！
         */
        function tableConditionRender(tableLayFilter,paramFormLayFilter,paramJson,isClear,isPage,limit){
            var params = {};
            try {
                if(paramJson){
                    if (typeof paramJson == 'string') {
                        params=JSON.parse(paramJson);
                    }else if(typeof paramJson == "object"){
                        if(paramJson){
                            params = paramJson;
                        }
                    }
                }
            } catch(e) {
                throw "Parameter format error -->"+e;
            }
            if(!limit){
                limit=20;
            }
            if(!isPage){
                var page={curr: 1, limit: limit};
                params.page=page;
            }
            if(paramFormLayFilter){
                if(isClear){
                    $("div[lay-filter='"+paramFormLayFilter+"']").find(".filter-value").each(function() {
                        params.where[this.name] = "";
                    });
                }else{
                    $("div[lay-filter='"+paramFormLayFilter+"']").find(".filter-value").each(function() {
                        params.where[this.name] = this.value;
                    });
                }
            }
            params.height = publicMethods.tabHeight()
            table.reload(tableLayFilter, params);
            if(paramFormLayFilter){
                if(!isClear){
                    setTimeout(function () {
                        form.val(paramFormLayFilter,params.where);
                        if (params.where.Q_fj_S == 0){
                            // 选中内容
                            $("#Q_fj_S").val("0");
                            $("#Q_fj_S").attr("checked",true);
                        } else {
                            // 选中附件
                            $("#Q_fj_S").val("1");
                            $("#Q_fj_S").attr("checked",false);
                        }
                    },0)
                }
            }
            setTimeout(function(){
                table.resize(tableLayFilter);
            },10);
            $('.selchBtn button i.screen').addClass("data-iconcommon_uparrow").removeClass('data-iconcommon_downarrow')
        }

        window.Initialization = function () {
            reflashQuery(false);
            dateReflash();
        };
        common.tableSort("wQbdFalProblemresetTable");
    });
</script>
</body>
</html>